import Vue from "vue";
import VueRouter from "vue-router";

// 登陆 
import Login from "@/views/appLogin"
//注册
import Register from '@/views/appRegister'
// 购物车
import Cart from "@/views/appCart"
// 分类
import Sort from "@/views/appSort"
// 首页
import Home from "@/views/appHome"
// 我的
import Mine from "@/views/appMine"
// 列表页
import List from "@/views/appList"
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "/home",
  },
  {
    path: "/home",
    name: "home",
    component: Home,
    meta: {
      permission: false,
      TabbarShow: true
    }
  },
  {
    path: "/login",
    name: "login",
    component: Login,
    meta: {
      permission: false,
      TabbarShow: false
    }
  },
  {
    path: "/register",
    name: "register",
    component: Register,
    meta: {
      permission: false,
      TabbarShow: false
    }
  },
  {
    path: "/cart",
    name: "cart",
    component: Cart,
    meta: {
      permission: false,
      TabbarShow: true
    }
  },
  {
    path: "/sort",
    name: "sort",
    component: Sort,
    meta: {
      permission: false,
      TabbarShow: true
    }
  },{
    path: "/mine",
    name: "mine",
    component: Mine,
    meta: {
      // permission: false,
      TabbarShow: true
    }
  },
  {
    path: "/listPage",
    name: "list",
    component: List,
    meta: {
      permission: false,
      TabbarShow: false
    }
  },
];

const router = new VueRouter({
  mode:"history",
  routes
});
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
export default router;
